var currentIndexTemp = 0;
var indexTemp = 0;
//var grid = efgrid.getGridObject("ef_grid_result");
//var fdCurrentDate=grid.getCellValueByColumnName(0,"fdCurrentDate");
//var nf = fdCurrentDate.substring(0,fdCurrentDate.indexOf("-"));;
var nf;
efform_onload = function ()
{
}; 

function fundiv(currentIndex,index){  
	currentIndexTemp = currentIndex;
	indexTemp = index;
	if(index ==0)
	{  
		var frame = frames[0];
		frame.src = "DispatchAction.do?efFormEname=ZMCK31"+"&nf="+nf+"&flag=1";
		efform.setStatus(0, "正在加载...");
	}else if(index ==1)
	{ 
		var frame = frames[1];
		frame.src = "DispatchAction.do?efFormEname=ZMCK32" +"&nf="+nf+"&flag=1";
		efform.setStatus(0, "正在加载...");
	}else if(index ==2)
	{ 
		var frame = frames[2];
		frame.src = "DispatchAction.do?efFormEname=ZMCK33"+"&nf="+nf+"&flag=1";
		efform.setStatus(0, "正在加载...");
	}else if(index ==3)
	{ 
		var frame = frames[3];
		frame.src = "DispatchAction.do?efFormEname=ZMCK34"+"&nf="+nf+"&flag=1";
		efform.setStatus(0, "正在加载...");
	}else if(index ==4)
	{ 
		var frame = frames[4];
		frame.src = "DispatchAction.do?efFormEname=ZMCK35"+"&nf="+nf+"&flag=1";
		efform.setStatus(0, "正在加载...");
	}
} 

button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCK30","query");
}

button_insert_onclick = function (){
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCK30","insert",true);
}

button_update_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0){
		return; 
	} 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCK30","update",true);
}

button_delete_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return;  
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r){
			efgrid.submitForm( "ef_grid_result", "ZM","ZMCK30","delete",true);
		}
	}); 
}

button_execute_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0){
		return; 
	} 
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCK30","execute",true);
}

efgrid_onRowClicked = function( grid_id, row_index ){
	if(grid_id == "ef_grid_result"){ 
		var grid = efgrid.getGridObject(grid_id);
		var fdCurrentDate=grid.getCellValueByColumnName(row_index,"fdCurrentDate");
	     nf = fdCurrentDate.substring(0,fdCurrentDate.indexOf("-"));
		fundiv(currentIndexTemp,indexTemp);
	}
}; 